package com.wk.warehouse.service.impl;

import java.util.HashMap;
import java.util.List;
import com.wk.warehouse.entity.InStore;
import com.wk.warehouse.mapper.InStoreMapper;
import com.wk.warehouse.page.Page;
import com.wk.warehouse.service.InStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class InStoreServiceImp implements InStoreService {

	@Autowired
	private InStoreMapper inStoreMapper;

	/**
	 * 查询入库单条数
	 */
	@Override
	public int selectCount(InStore inStore) {
		return inStoreMapper.selectCount(inStore);
	}

	/**
	 * 分页查询
	 */
	@Override
	public List<InStore> selectInStorePage(InStore inStore, Page page) {
		HashMap<String, Object> map = new HashMap<>();
		map.put("inStore", inStore);
		map.put("page", page);
		return inStoreMapper.selectInStorePage(map);
	}

	/**
	 * 用户请求入库
	 */
	@Override
	public int updateInStoreState(int insId){
		return inStoreMapper.updateInStoreState(insId);
	}
	
	@Override
	public int updateStoreInvent(InStore inStore){
		return inStoreMapper.updateStoreInvent(inStore);
	}

	/**
	 * 生成入库单，默认未审核
	 */
	public int addInStoreForm(InStore inStore){
		return inStoreMapper.addInStoreForm(inStore);
	}

	/**
	 * 生成入库单，默认已审核
	 */
	public int addInStoreForm1(InStore inStore){
		return inStoreMapper.addInStoreForm1(inStore);
	}

}

